build:
	docker build -t ingress-manager:1.0.0 .


yml:
	kubectl create deployment ingress-manager --image  ingress-manager:1.0.0 --dry-run=client  -o yaml > mainifests/ingress-manager.yml
	# 下面这句是给deployment配置serviceAccount, makefile 会报错，需要拷贝到终端执行
	# sed -i  "" '19a\'$'\n      serviceAccountName: ingress-manager-sa \n' mainifests/ingress-manager.yml
	# 配置拉取策略 sed -i  "" '22a\'$'\n        imagePullPolicy: IfNotPresent \n' mainifests/ingress-manager.yml
	echo "---" >> mainifests/ingress-manager.yml
	kubectl create serviceaccount ingress-manager-sa --dry-run=client -o yaml  >> mainifests/ingress-manager.yml
	echo "---" >> mainifests/ingress-manager.yml
	kubectl create clusterrole ingress-manager-role --resource=ingress,service --verb list,watch,create,update,delete --dry-run=client -o yaml  >> mainifests/ingress-manager.yml
	echo "---" >> mainifests/ingress-manager.yml
	kubectl create clusterrolebinding ingress-manager-rb --clusterrole ingress-manager-role --serviceaccount default:ingress-manager-sa  --dry-run=client -o yaml  >> mainifests/ingress-manager.yml

apply:
	kubectl apply -f mainifests

delete:
	kubectl delete -f mainifests


generate:
	/Users/yu/code/code-generator/generate-groups.sh all  gitee.com/goeoeo/k8s-crd/pkg/generated  gitee.com/goeoeo/k8s-crd/pkg/apis crd.example.com:v1 -h /Users/yu/code/code-generator/examples/hack/boilerplate.go.txt --output-base ../../../
